/*
 * @lc app=leetcode.cn id=1 lang=javascript
 *
 * [1] 两数之和
 */

// @lc code=start
/**
 * @param {number[]} nums
 * @param {number} target
 * @return {number[]}
 */
var twoSum = function(nums, target) {
  let result = [];
  nums.forEach((item, index) => {
    for (let i = index + 1 ; i < nums.length; i++) {
      if (item + nums[i] === target) {
        result = [index, i]
        return;
      }
    }
    if (result.length) return;
  })
  return result;
};
// @lc code=end

